home *** CD-ROM | disk | FTP | other *** search
- Path: news.cyberhighway.net!usenet
- From: lassiter@cyberhighway.net (lassiter)
- Newsgroups: comp.lang.c
- Subject: Could someone help me with this imbedded assembly code
- Date: 18 Mar 1996 21:54:49 GMT
- Organization: Your Organization
- Message-ID: <4ikm39$g8b@host-3.cyberhighway.net>
- NNTP-Posting-Host: dallaspm1-12.cyberhighway.net
- Mime-Version: 1.0
- Content-Type: Text/Plain; charset=US-ASCII
- X-Newsreader: WinVN 0.99.7
-
- #include <iostream.h>
-
- unsigned char scankey(void)
- {
- asm{
- mov ah, 01h
- int 16h
- jz empty;
- mov ah, 00h
- int 16h
- mov al, ah
- xor ah, ah
- jmp done;
- empty:
- xor ax, ax
- done:
- }
- }
- void main(void)
- {
- unsigned char key = 'a';
- do
- {
- cout << key << endl;
- key = scankey();
- } while (key != 'q');
- }
-
-
- Could someone tell me what is wrong with this code? I am using Borland
- C++ 3.0. The errors I am getting are
-
- error test.cpp 19: undefined label 'done'
- error test.cpp 19: undefined label 'empty'
- warning test.cpp 19: Function should return a value
-
- This program is supposed to display a character on each line and read
- the keyboard buffer to see if a key had been pressed. If a key was
- pressed it will then print that character instead. It will repeat until
- the q key is pressed. Don't judge it too harshly, I'm only a beginner!
-
- Larry
- lassiter@cyberhighway.net
-
-
-
-
-
-
-